package WaiBao;

import java.util.Arrays;

public class WangMengTing {
    public static void main(String[] args) {
        String[] name = {"张大大(班长)", "李绍普(团支书)", "小李(学习委员)", "王惊蛰(体育委员)", "武松", "西门庆", "清雪莹", "荀彧", "庞统", "薛宝才", "林黛玉", "贾母",
                "刘姥姥", "凌达乐", "郭俊峰", "赵德怀", "李忠政", "张学友", "许巍", "那英", "李道翠", "李华", "李文", "张国荣", "周东功", "陈佩斯", "冯巩", "小沈阳",
                "赵本山", "王梦婷(心理委员)"};//考生本人: 王梦婷(心理委员)
        int[] Age = {20, 18,19, 21, 22, 21, 21, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 19, 21, 19,20};//考生年龄：20岁


        double[] candy1 = {90, 82, 94, 80, 79, 69, 78, 89, 81, 90, 90, 87, 85, 71, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 95};
        double[] candy2 = {78, 84, 79, 71, 88, 74, 80, 74, 90, 90, 94, 76, 86, 75, 65, 65, 86, 79, 64, 68, 92, 71, 95, 85, 75, 84, 79, 64, 90, 96};
        double[] candy3 = {70, 96, 90, 85, 71, 69, 78, 89, 80, 61, 93, 87, 85, 75, 65, 68, 69, 89, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 96};

        double xiaolan1;//代表每个学生的总分
        double xiaolan2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            xiaolan1 = candy1[i] + candy2[i] +candy3[i];
//            xiaolan2 = (  xiaolan1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + xiaolan1);
//            System.out.println(name[i] + "的平均分为:" + xiaolan2);
//        }


        double baby1 = 0, baby2 = 0;
        double[] gar = new double[30];
//        for (int i = 0; i < 30; i++) {
//            baby1  = candy1[i] + candy2[i] + candy3[i];
//            baby2 = (baby1* 1.0) / 3;
//            gar[i] = baby2;
//        }
//
//        for (int i = 0; i < gar.length - 1; i++) {
//            for (int j = 0; j < gar.length - i - 1; j++) {
//                if (gar[j] < gar[j + 1]) {
//                    double tep = gar[j];
//                    gar[j] =gar[j + 1];
//                    gar[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(gar[i]);
//        }


        double tanhua1 = 0,tanhua2 = 0, tanhua3 = 0;//计算每门课的平均分
        double guihua1 = 0,guihua2 = 0, guihua3 = 0;//计算每门课标准差
        double meigui1 = 0, meigui2 = 0,meigui3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < candy1.length; i++) {
            sum2+=candy1[i];
        }
        tanhua1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+tanhua1);
        double Sum = 0;
        for (int i = 0; i <candy2.length; i++) {
            Sum+=candy2[i];
        }
        tanhua2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+tanhua2);
        double sum = 0;
        for (int i = 0; i <candy3.length; i++) {
            sum+=candy3[i];
        }
        tanhua3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+tanhua3);



        double c1 = 0,c2 = 0,c3 = 0;
//        for (int i = 0; i <candy1.length; i++) {
//            c1+= (candy1[i] -guihua1)*(candy1[i] -guihua1);
//        }
//        guihua1 = Math.sqrt(c1*1.0/30);
//        System.out.println("生物化学的班级标准差为:"+guihua1);
//
//        for (int i = 0; i <candy2.length; i++) {
//            c2+= (candy2[i] - tanhua2)*(candy2[i] - tanhua2);
//        }
//        guihua2 = Math.sqrt(c2*1.0/30);
//        System.out.println("微生物学的班级标准差为:"+guihua2);
//
//        for (int i = 0; i <candy3.length; i++) {
//            c3+= (candy3[i] -tanhua3)*(candy3[i] - tanhua3);
//        }
//        guihua3 = Math.sqrt(c3*1.0/30);
//        System.out.println("人体组织解剖学的班级标准差为:"+guihua3);
//////
//////
//        Arrays.sort(candy1);
//        Arrays.sort(candy2);
//        Arrays.sort(candy3);
//        meigui1 =( candy1[14]+candy1[15])*1.0/2;
//        meigui2 =( candy2[14]+candy2[15])*1.0/2;
//        meigui3 =( candy3[14]+candy3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+meigui1);
//        System.out.println("微生物学的中位数为:"+meigui2);
//        System.out.println("人体组织解剖学的中位数为:"+meigui3);


    }
}
